home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Sample.bin / AboutDialog.java < prev    next >
Text File  |  1998-11-01  |  2KB  |  89 lines

  1.  
  2.  
  3.  
  4. /*
  5.     A basic extension of the java.awt.Dialog class
  6.  */
  7.  
  8. import java.awt.*;
  9.  
  10. public class AboutDialog extends Dialog {
  11.     public AboutDialog(Frame parent, boolean modal) {
  12.  
  13.         super(parent, modal);
  14.  
  15.         //{{INIT_CONTROLS
  16.         setLayout(null);
  17.         setSize(357,158);
  18.         setVisible(false);
  19.         label1.setText("JavaPad - A Simple editor written in Java!");
  20.         add(label1);
  21.         label1.setBounds(50,40,251,21);
  22.         okButton.setLabel("OK");
  23.         add(okButton);
  24.         okButton.setBounds(120,70,95,26);
  25.         setTitle("About");
  26.         //}}
  27.     
  28.         //{{REGISTER_LISTENERS
  29.         SymAction lSymAction = new SymAction();
  30.         okButton.addActionListener(lSymAction);
  31.         //}}
  32.     }
  33.  
  34.     public AboutDialog(Frame parent, String title, boolean modal) {
  35.         this(parent, modal);
  36.         setTitle(title);
  37.     }
  38.  
  39.   
  40.  //-------------------------------------------------------------
  41.  // This file has been migrated from the 1.0 to 1.1 event model.
  42.  // This method is not used with the new 1.1 event model. You can 
  43.  // move any code you need to keep, then remove this method.
  44.  //-------------------------------------------------------------
  45.  // 
  46.  //     public boolean handleEvent(Event event) {
  47.  //         if(event.id == Event.WINDOW_DESTROY) {
  48.  //             hide();
  49.  //             return true;
  50.  //         }
  51.  //         if (event.target == okButton && event.id == Event.ACTION_EVENT) {
  52.  //             okButton_Clicked(event);
  53.  //         }
  54.  //         return super.handleEvent(event);
  55.  //     }
  56.  //-------------------------------------------------------------
  57.  
  58.     //{{DECLARE_CONTROLS
  59.     java.awt.Label label1 = new java.awt.Label();
  60.     java.awt.Button okButton = new java.awt.Button();
  61.     //}}
  62.  
  63.  
  64.     class SymAction implements java.awt.event.ActionListener
  65.     {
  66.         public void actionPerformed(java.awt.event.ActionEvent event)
  67.         {
  68.             Object object = event.getSource();
  69.             if (object == okButton)
  70.                 okButton_ActionPerformed(event);
  71.         }
  72.     }
  73.  
  74.     void okButton_ActionPerformed(java.awt.event.ActionEvent event)
  75.     {
  76.         // to do: code goes here.
  77.              
  78.         okButton_ActionPerformed_Interaction1(event);
  79.     }
  80.  
  81.     void okButton_ActionPerformed_Interaction1(java.awt.event.ActionEvent event)
  82.     {
  83.         try {
  84.             this.dispose();
  85.         } catch (Exception e) {
  86.         }
  87.     }
  88. }
  89.